package ms.maplestory.boot.constants;

public class JobConstants {

    public static boolean isExtendSpJob(int jobId) {
        return !(jobId / 1000 != 3 && jobId / 100 != 22 && jobId != 2001);
    }

    public static boolean isBeginnerJob(int jobId) {
        switch (jobId) {
            case 8001:
            case 13000:
            case 14000:
            case 6000:
            case 6001:
            case 5000:
            case 4001:
            case 4002:
            case 3001:
            case 3002:
            case 2001:
            case 2002:
            case 2003:
            case 2004:
            case 2005:
                return true;
            default:
                return jobId % 1000 == 0 || jobId / 100 == 8000;
        }
    }
    public static boolean isEvan(int jobId) {
        return jobId / 100 == 22 || jobId == 2001;
    }
    public static boolean isDualBlade(int job) {
        return job / 10 == 43;
    }
    private static int getEvanJobLevel(int jobId) {
        int result;
        switch (jobId) {
            case 2200:
            case 2210:
                result = 1;
                break;
            case 2211:
            case 2212:
            case 2213:
                result = 2;
                break;
            case 2214:
            case 2215:
            case 2216:
                result = 3;
                break;
            case 2217:
            case 2218:
                result = 4;
                break;
            default:
                result = 0;
                break;
        }
        return result;
    }
    public static int getJobLevel(int jobId) {
        int prefix;
        if (isBeginnerJob(jobId) || (jobId % 100 == 0) || jobId == 501 || jobId == 508 || jobId == 3101) {
            return 1;
        }
        if (isEvan(jobId)) {
            return getEvanJobLevel(jobId);
        }
        if (isDualBlade(jobId)) {
            prefix = (jobId % 10) + 2;
            if (prefix < 2) {
                return 0;
            } else if (prefix <= 6) {
                return jobId % 10 + 2;
            }
        } else {
            prefix = jobId % 10;
        }
        return prefix <= 2 ? prefix + 2 : 0;
    }
}
